package com.ketangpai.admin.entity;


import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ketangpai.admin.entity.param.CreateCourseParam;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.RandomStringUtils;

import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

/**
 * 课程表(Course)实体类
 *
 * @author makejava
 * @since 2023-06-14 01:00:26
 */
@Data
public class Course  {
    /**
     * 课程id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 课程名称
     */
    private String courseName;
    /**
     * 课程名称
     */
    private String courseCode;
    /**
     * 创建人id
     */
    private Integer userId;
    /**
     * 班级
     */
    private String clazz;
    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * 上课模式（1：线上 2：线下 3:混合）
     */
    private int mode;
    /**
     * 课程详情
     */
    private String courseDetail;
    /**
     * 上课地点
     */
    private String courseLocation;
    /**
     * 学期
     */
    private String semester;
    /**
     * 学年
     */
    private String academicYear;
    /**
     * 背景图片
     */
    private String backgroundImage;
    /**
     * 学时
     */
    private Integer courseHour;

    /**
     * 文件
     */
    @TableField(exist = false)
    @ApiModelProperty(dataType = "MultipartFile" ,name = "文件",value = "file")
    private MultipartFile file;

    public Course(){

    }
    public void setCourse(CreateCourseParam createCourseParam, String courseCode){
        this.courseCode=courseCode;
        this.courseDetail=createCourseParam.getCourseDetail();
        this.academicYear=createCourseParam.getAcademicYear();
        this.courseHour=createCourseParam.getCourseHour();
        this.backgroundImage=null;
        this.clazz=createCourseParam.getClazz();
        this.courseLocation=createCourseParam.getCourseLocation();
        this.courseName=createCourseParam.getCourseName();
        this.createTime=new Date();
        this.mode=createCourseParam.getMode();
        this.semester=createCourseParam.getSemester();
        this.userId=createCourseParam.getUserId();
    }

}

